// local to local tool

package com.smart.utils {

	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.geom.Point;

	public class ContainerUtils {
	
		public static function getAllClassIn ( container:Sprite, class_type:Class  ) : Array { 
				
			var array:Array = new Array; 
			
			// test all children, only add in if they are a certain class type 
			for ( var ii:int = 0; ii < container.numChildren; ii++ ) {					
				if ( container.getChildAt(ii) is class_type ) {
					array.push(container.getChildAt(ii)); 
				} 
			}
								
			return array; 
		}
				
		
		public static function getAllClassInExcept ( container:Sprite, class_type:Class, except:DisplayObject ) : Array { 
			
			// same as above, but exclude the supplied except object 
			var array:Array = new Array; 
			for ( var ii:int = 0; ii < container.numChildren; ii++ ) {					
				if ( container.getChildAt(ii) is class_type ) {
					if ( container.getChildAt(ii) != except ) 
						array.push(container.getChildAt(ii)); 
				}
			}					
			return array; 
		}
		

		public static function getOneClassIn( container:Sprite, class_type:Class ) : DisplayObject { 
			
			// same as above, but exclude the supplied except object 
			for ( var ii:int = 0; ii < container.numChildren; ii++ ) {					
				if ( container.getChildAt(ii) is class_type ) {
					return container.getChildAt(ii);
				}
			}					
			return null; 
		}		
		
		
		 
	}
}